package cn.yanxiaohui.common.exception;

public class APIException extends Exception{
	/**
	 * 异常类
	 *
	 */
    private static final long serialVersionUID = 1L;
    // 默认请求失败状态码
    private static final Integer DEFAULT_ERROR_CODE = 500;
    // 默认请求成功状态码
    private static final Integer DEFAULT_SUCCESS_CODE = 200;

    private Integer errorCode = null;
    private String errorMsg = null;
    private String resolvedMsg = null;

    /**
     * 构造函数：errorCode
     */
    public APIException(Integer errorCode) {
        super("");
        this.errorCode = errorCode;
        this.errorMsg = "";
        this.resolvedMsg = "";
    }

    /**
     * 构造函数：errorCode
     */
    public APIException(String errorMsg) {
        super(errorMsg);
        this.errorCode = DEFAULT_ERROR_CODE;
        this.errorMsg = errorMsg;
        this.resolvedMsg = "";
    }

    /**
     * 构造函数：errorCode。errorMsg
     */
    public APIException(Integer errorCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
        this.resolvedMsg = "";
    }

    /**
     * 构造函数：errorCode。errorMsg。resolvedMsg
     */
    public APIException(Integer errorCode, String errorMsg, String resolvedMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
        this.resolvedMsg = resolvedMsg;
    }

    /**
     * 取得异常编码，限定在30个字节
     *
     * @return 异常编码，限定在30个字节
     */
    public Integer getErrorCode() {
        return this.errorCode;
    }

    /**
     * 设置异常编码，限定在30个字节
     *
     * @param errorCode 异常编码，限定在30个字节
     */
    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    /**
     * 取得异常描述，限定在1000个字节
     *
     * @return 异常描述，限定在1000个字节
     */
    public String getErrorMsg() {
        return this.errorMsg;
    }

    /**
     * 设置异常描述，限定在1000个字节
     *
     * @param errorMsg 异常描述，限定在1000个字节
     */
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    /**
     * 取得解决方法描述，限定在1000个字节，可为null
     *
     * @return 解决方法描述，限定在1000个字节，可为null
     */
    public String getResolvedMsg() {
        return this.resolvedMsg;
    }

    /**
     * 设置解决方法描述，限定在1000个字节，可为null
     *
     * @param resolvedMsg 解决方法描述，限定在1000个字节，可为null
     */
    public void setResolvedMsg(String resolvedMsg) {
        this.resolvedMsg = resolvedMsg;
    }
}
